/**
 * gislin 2017年9月20日
 */
package com.btcode.orm.relation;

import com.btcode.orm.model.IField;

/**
 * @author gislin 2017年9月20日
 */
public class Join {


    OneToMany relation;

    public Join(IField masterField) {
        relation = new OneToMany(masterField);
    }

    public Join join(IField slaveField) {

        if (relation.getSlaveField() == null) {
            relation.setSlaveField(slaveField);
        }
        else {
            OneToMany nextRelation = new OneToMany(relation.getSlaveField(), slaveField);
            relation.setNextRelation(nextRelation);
        }
        return this;
    }

}
